//Name: Cao Dung Anh
//Class: 11CTT
//Sid: 1151003


#pragma once
#include "BookInfo.h"

class BookList
{
private:
	typedef struct Node
	{
		BookInfo data;
		Node *next;
	}Node;
	Node *head;
	Node *subhead;
public:
	BookList();
	void addBooktoList();
	void addBooktoList(char *ISBN);
	void updateBookList();
	void loadBooks();
	bool showAllBook();
	void showSubList();
	void addNodetoSubList(Node *cur);
	void freeSubhead();
	void freeHead();
	int inStock(char *ISBN);
	bool filterbyName();
	bool filterbyType();
	bool filterbyISBN();
	bool filterbyStock();
	bool filterbyYoP();
	void insertBook();
	bool updateStock(Node *cur);
	void decreaseStock(char *ISBN);
	char *getNamebyISBN(char* ISBN);
	bool isExist(char *ISBN);
	void showBook(char *ISBN);

	//Phuong Anh
	void SortbyYoPAscending();
	void SortbyYoPDescending();
	void SortbyStockAscending();
	void SortbyStockDescending();
	void SortbyNameAscending();
	void SortbyNameDescending();
	void SortbyTypeAscending();
	void SortbyTypeDescending();
	void SortbyISBNAscending();
	void SortbyISBNDescending();

	void WriteBookInfoXMLfile();
	void WriteBookInfoCSVfile();
};